package com.javasm.commons.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Component //注册到容器
@ConfigurationProperties(prefix = "boot")   //配置信息 application.yml  配置的前缀为 boot.corsConfig
public class BootProperties {
    private CorsConfig corsConfig;

    private ValicodeAk valicodeAk;

    private OSSInfo ossInfo;

    public static class OSSInfo {
        private String endPoint;
        private String keyid;
        private String keySecret;

        public String getEndPoint() {
            return endPoint;
        }

        public void setEndPoint(String endPoint) {
            this.endPoint = endPoint;
        }

        public String getKeyid() {
            return keyid;
        }

        public void setKeyid(String keyid) {
            this.keyid = keyid;
        }

        public String getKeySecret() {
            return keySecret;
        }

        public void setKeySecret(String keySecret) {
            this.keySecret = keySecret;
        }
    }

    public OSSInfo getOssInfo() {
        return ossInfo;
    }

    public void setOssInfo(OSSInfo ossInfo) {
        this.ossInfo = ossInfo;
    }

    public static class CorsConfig{
        private String path;
        private List<String> origins;
        private List<String> allowedHeaders;
        private List<String> allowedMethods;
        private Boolean withCredentials;
        private List<String> exposedHeaders;
        private Long maxAge;

        public String getPath() {
            return path;
        }

        public void setPath(String path) {
            this.path = path;
        }

        public List<String> getOrigins() {
            return origins;
        }

        public void setOrigins(List<String> origins) {
            this.origins = origins;
        }

        public List<String> getAllowedHeaders() {
            return allowedHeaders;
        }

        public void setAllowedHeaders(List<String> allowedHeaders) {
            this.allowedHeaders = allowedHeaders;
        }

        public List<String> getAllowedMethods() {
            return allowedMethods;
        }

        public void setAllowedMethods(List<String> allowedMethods) {
            this.allowedMethods = allowedMethods;
        }

        public Boolean getWithCredentials() {
            return withCredentials;
        }

        public void setWithCredentials(Boolean withCredentials) {
            this.withCredentials = withCredentials;
        }

        public List<String> getExposedHeaders() {
            return exposedHeaders;
        }

        public void setExposedHeaders(List<String> exposedHeaders) {
            this.exposedHeaders = exposedHeaders;
        }

        public Long getMaxAge() {
            return maxAge;
        }

        public void setMaxAge(Long maxAge) {
            this.maxAge = maxAge;
        }
    }

    public ValicodeAk getValicodeAk() {
        return valicodeAk;
    }

    public void setValicodeAk(ValicodeAk valicodeAk) {
        this.valicodeAk = valicodeAk;
    }

    public static class ValicodeAk{
        private String keyid;
        private String keySecret;
        private String signName;
        private String templateCode;

        public String getKeyid() {
            return keyid;
        }

        public void setKeyid(String keyid) {
            this.keyid = keyid;
        }

        public String getKeySecret() {
            return keySecret;
        }

        public void setKeySecret(String keySecret) {
            this.keySecret = keySecret;
        }

        public String getSignName() {
            return signName;
        }

        public void setSignName(String signName) {
            this.signName = signName;
        }

        public String getTemplateCode() {
            return templateCode;
        }

        public void setTemplateCode(String templateCode) {
            this.templateCode = templateCode;
        }
    }

    public CorsConfig getCorsConfig() {
        return corsConfig;
    }

    public void setCorsConfig(CorsConfig corsConfig) {
        this.corsConfig = corsConfig;
    }
}
